﻿#ifndef __NGX_DEFINE_STRUCTS_H__
#define __NGX_DEFINE_STRUCTS_H__

typedef  struct  DeviceInfo
{
	int			nID;
	UINT		nDevID;

	char			szCCID[64];
	char			szIp[32];
	char			szVersion[32];  //版本
	char			szProject[64];
	bool			bOnline;		//是否在线
	char			cTimeOut;		//
	UINT        uNumOnOff;
	UINT        uValOnOff;
	UINT        uVoltage;
	//Json::Value jBody;
	//Json::Value jBodyLast;
	//Json::Value jBodyDeviceStatus;

	double		dTemperature;	//温度
	double		dHum;			//湿度

	char		szRemarks[32];
	int			nProjectId;
	char		szLastOnLineTime[32];
	char		szName[64];
	UINT         nType;
	char		 TypeName[128];
	void* pSocket;
	int          nCount;
	bool         bCheckOnline;
	time_t       time_login;
	//bool         bPower;
	//bool         bLock;
	//int          nSetTimeCmd;
	//short        sMode;
	//short        sManule;

	//UCHAR        cPortConfig[32];
	//UCHAR        cPortStatus[32];
	//UCHAR        cSysTime[32];         //系统时间
	//UCHAR        cStartupTime[32];  //开机时间
	//UCHAR        cTurnOffTime[32];//关机时间
	//UCHAR        cPowon[12];
	//kz027
	//UCHAR          c_ComputerStatas[6];
	//UCHAR          c_Kz027Statas[6];
	//UCHAR          cDevData[32];
	//UINT				 uGatewayInput;
	//char                 cActiveTime[32];
	//char                 cGatewayLock[6];  //每一路,锁状态0,1,2,3
	//char                 cSelfBoot[3];  //
	//time_t			 tPowergatewayUpdateTime;

	//Json::Value    LockUser;
	/*
	电源网关用[0,1,2]
	*/
	//bool	     bOnOffEnable;                       //使能
	//int		 nOnOffTimer;
	//bool	     bSetTime;
	bool operator ==(const UINT& x)
	{
		return(this->nDevID == x);
	}
}Device_Info;
typedef  struct  UserInfo
{
	int		     nUserId;
	//string	 szUserName;
	char		 szUserName[64];
	char		 szIp[64];
	int		     nUserProjectId;
	void* pSocket;

	int	           nUserType;
	
	bool operator ==(const string& x)
	{
		return(this->szUserName == x);
	}
	bool operator ==(const int& x)
	{
		return(this->nUserId == x);
	}
}UserInfo;
typedef  struct  DeviceMessage
{
	int				nSessionId;
	UINT			nDevID;
	USHORT			uCommand;
	UINT	        uUserID;
	void			*pSocket;
}DeviceMessage;

typedef  struct  MessageSubscribe
{
	UINT			nDevID;
	UINT			nUserId;
}MessageSubscribe;


#endif